#import <Cocoa/Cocoa.h>

typedef struct BWSymbolItem {
    NSBezierPathElement type;
    NSPoint points[3]; // for curve, it's control, control, endPoint
} BWSymbolItem;

// for pasteboards
extern NSString *BWSymbol_PackageNameType; // NSString
extern NSString *BWSymbol_SymbolIdType;    // int in NSNumber

@interface BWSymbol : NSObject <NSCoding, NSCopying>
{
    int itemCount;
    BWSymbolItem *items;

    int ghostIndex; // 0 .. pointCount, -1 for no ghosting
    NSPoint ghostPoint;

    NSString *name;
    NSString *keywords;

    // together these should be unique
    NSString *packageName; // the .bwstitch file name
    int symbolId;  // which symbol in the package this is
}

// point iterator, or point at index


- (int) pointCount;
- (NSPoint) pointAtIndex: (int) index; // 0 .. pointCount
- (void) setPoint: (NSPoint) point  atIndex: (int) index; // 0 .. pointCount

- (int) elementIndexForPointIndex: (int) index;


// pointCount >= elementCount

- (int) elementCount;
- (NSBezierPathElement) elementAtIndex: (int) index // 0 .. elementCount
                      associatedPoints: (NSPoint *) points; // NULL OK
- (void) addElement: (NSBezierPathElement) element
         atIndex: (int) index
   associatedPoints: (NSPoint *) points;

- (void) removeElementIndex: (int) index;

- (void) setGhostIndex: (int) index  point: (NSPoint) point;

- (NSString *) name;
- (void) setName: (NSString *) name;

- (NSString *) keywords;
- (void) setKeywords: (NSString *) keywords;

- (NSBezierPath *) pathInRect: (NSRect) rect;
- (NSImage *) imageInRect: (NSRect) rect;

- (void) offsetPathByX: (float) x  Y: (float) y;

- (void) setPackageName: (NSString *) packageName;
- (NSString *) packageName;

- (void) setSymbolId: (int) symbolId;
- (int) symbolId;

@end // BWSymbol


